// 柯里化演示

function checkAge(age) {
    let min = 18
    return age >= min
}

// // 普通的纯函数
function checkAge (min, age) {
    return age >= min
}
console.log(checkAge(18,20))
console.log(checkAge(18,24))
console.log(checkAge(22,24))

//柯里化
function checkAge(min) {
    return function(age) {
        return age >= min
    }
}

let check18 = checkAge(18)
let check20 = checkAge(20)

console.log(check18(20))
console.log(check20(22))

//es6优化
let checkAge = min => (age => age >= min) 
let check22 = checkAge(22)
console.log(check22(20))


